package me.xiaoyan.java.chapter13;

/**
 * 电脑用户类
 * @author keley
 * @version 1.0.1
 * @date 2014-8-19
 */
public class Computer {
	/**
	 * 电脑名字
	 */
	String name;
	/**
	 * 电脑分数
	 */
	int score;

	/**
	 * 电脑出拳
	 * @return 返回电脑的出拳编号
	 */
	public int showFist(){
		//产生1-3的随机数
		int choice = (int)(Math.random() * 3) + 1;

		String fist = name + "出拳:";
		switch (choice) {
		case 1:
			fist = fist + "剪刀";
			break;
		case 2:
			fist = fist + "石头";
			break;
		default:
			fist = fist + "布";
			break;
		}
		System.out.println(fist);
		return choice;
	}
}
